﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Giamsatnuocthai.aspx.cs" Inherits="Giamsatdinhky_Giamsatnuocthai" Title="Untitled Page" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            </script>

        </telerik:RadCodeBlock>
         <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        
            <p id="divMsgs" runat="server">
        <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>
            </p>
      
         <!-- load ajax-->
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid_gsat">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid_gsat" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="divMsgs" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <!-- end-->
        
        
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
            BackColor="#99FF66" Skin="WebBlue" />
        <telerik:RadGrid ID="RadGrid_gsat" runat="server" AllowPaging="True" 
            AllowSorting="True" CellSpacing="0" DataSourceID="SqlDataSource_gsnuocthai" 
            GridLines="None" AllowAutomaticDeletes="True" AutoGenerateColumns="False"
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" OnItemUpdated="RadGrid_gsat_ItemUpdated"
             
           OnItemInserted="RadGrid_gsat_ItemInserted" 
        OnDataBound="RadGrid_gsat_DataBound" Skin="Telerik">
                <HeaderContextMenu></HeaderContextMenu>

                <MasterTableView AutoGenerateColumns="False" DataKeyNames="Mags" 
                                DataSourceID="SqlDataSource_gsnuocthai" 
                    CommandItemDisplay="Top">
                                
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>

                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>

    <Columns>
                    
        <telerik:GridBoundColumn DataField="Mags" DataType="System.Int32"
            FilterControlAltText="Filter Mags column" HeaderText="Mags" ReadOnly="True" 
            SortExpression="Mags" UniqueName="Mags" Visible="false">
        </telerik:GridBoundColumn>
         <telerik:GridTemplateColumn HeaderText="STT">
                       <ItemTemplate>
                        <asp:Label runat="server" ID="lblSTT" Text='<%#i++%>'></asp:Label>
                       </ItemTemplate>
           </telerik:GridTemplateColumn>
        
        <telerik:GridBoundColumn DataField="Madnghiep" 
            FilterControlAltText="Filter Madnghiep column" HeaderText="Madnghiep" 
            SortExpression="Madnghiep" UniqueName="Madnghiep" DataType="System.Int32">
        </telerik:GridBoundColumn>
       
        <telerik:GridBoundColumn DataField="Madotgs" 
            FilterControlAltText="Filter Madotgs column" HeaderText="Madotgs" 
            SortExpression="Madotgs" UniqueName="Madotgs" DataType="System.Int32">
        </telerik:GridBoundColumn>
       
        <telerik:GridBoundColumn DataField="Vitrido" 
            FilterControlAltText="Filter Vitrido column" HeaderText="Vitrido" 
            SortExpression="Vitrido" UniqueName="Vitrido">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Luuluong" 
            FilterControlAltText="Filter Luuluong column" HeaderText="Luuluong" 
            SortExpression="Luuluong" UniqueName="Luuluong">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Donvi" 
            FilterControlAltText="Filter Donvi column" HeaderText="Donvi" 
            SortExpression="Donvi" UniqueName="Donvi">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Ghichu" 
            FilterControlAltText="Filter Ghichu column" HeaderText="Ghichu" 
            SortExpression="Ghichu" UniqueName="Ghichu">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Ngaynhap" DataType="System.DateTime" 
            FilterControlAltText="Filter Ngaynhap column" HeaderText="Ngaynhap" 
            SortExpression="Ngaynhap" UniqueName="Ngaynhap">
        </telerik:GridBoundColumn>
    </Columns>

            <EditFormSettings EditFormType="Template" ColumnNumber="2" CaptionDataField="Madnghiep" CaptionFormatString="Edit properties of Product {0}" InsertCaption="New Congxa">
            
<EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
            
                <FormTemplate>
       <table style="border-style: none groove none groove; position: relative; margin-left:170px; background-color: #FFFFBB; vertical-align: middle;">
        <tr style="width: 180px; height: 19px;">
		<td style="width: 151px; height: 19px"><span style="font-size: 9pt; color: #000000">
		    Doanh nghiệp</span>
                (<span style="color: #ff0000"><strong>*</strong></span>)
    </td>
        <td style="width: 180px; height: 19px;">
           
           <telerik:RadComboBox ID="gs_dn" runat="server" DataSourceID="giamsat_dn"
               Skin="Hay" DataTextField="TenDN" DataValueField='<%#Bind("Madnghiep") %>' >
                <Items>
                <telerik:RadComboBoxItem Selected="true" />
                </Items>
            </telerik:RadComboBox>
			  
			    </td>
	  	    <td style="width:5%"></td>
     </tr>
<tr style="width: 180px; height: 19px;">
		<td style="width: 151px; height: 19px"><span style="font-size: 9pt; color: #000000">
		    Đợt giám sát</span>
                (<span style="color: #ff0000"><strong>*</strong></span>)
    </td>
        <td style="width: 180px; height: 19px;">
            <telerik:RadComboBox ID="gs_dotgs" runat="server" DataSourceID="giamsat_dotgs"
               Skin="Hay" DataTextField="Dotgiamsat" DataValueField="Madotgs">
                <Items>
                <telerik:RadComboBoxItem Selected="true"/>
                </Items>
            </telerik:RadComboBox>
			       
			    </td>
	  	    <td style="width:5%"></td>
     </tr>
<tr style="width: 180px; height: 19px;">
		<td style="width: 151px"><span style="font-size: 9pt; color: #000000">
		    Vị trí đo</span>
    </td>
        <td style="width: 180px">
            <telerik:RadTextBox ID="txtViTriDo" runat="server">
            </telerik:RadTextBox>
        </td>
</tr>
<tr style="width: 180px; height: 19px;">
		<td style="width: 151px"><span style="font-size: 9pt; color: #000000">
		    Lưu lượng</span>
    </td>
        <td style="width: 180px">
             <telerik:RadNumericTextBox ID="txtLuuLuong" runat="server" NumberFormat-AllowRounding="false" NumberFormat-DecimalDigits="0" NumberFormat-DecimalSeparator="," NumberFormat-GroupSeparator=".">
              </telerik:RadNumericTextBox>
        </td>
</tr>
<tr style="width: 180px; height: 19px;">
		<td style="width: 151px; height: 19px"><span style="font-size: 9pt; color: #000000">
		    Đơn vị</span>
    </td>
         <td style="width: 180px">
            <telerik:RadTextBox ID="txtdonvi" runat="server" Text='<%# Bind("Donvi") %>'>
            </telerik:RadTextBox>
        </td>
     </tr>
<tr style="width: 180px; height: 19px;">
		<td style="width: 151px">
		    Ghi chú
    </td>
        <td style="width: 180px" colspan="2">
 <telerik:RadEditor ID="txtGhiChu" runat="server" Height="180px"
            Skin="Hay" Width="348px">                               
            <Tools>
                <telerik:EditorToolGroup>
                    <telerik:EditorTool Name="Bold" />
                    <telerik:EditorTool Name="Underline" />
                    <telerik:EditorTool Name="ConvertToLower" />
                    <telerik:EditorTool Name="ConvertToUpper" />
                    <telerik:EditorTool Name="Copy" />
                    <telerik:EditorTool Name="Cut" />
                    <telerik:EditorTool Name="Paste" />
                    <telerik:EditorTool Name="FontName" />
                    <telerik:EditorTool Name="FontSize" />
                    <telerik:EditorTool Name="ForeColor" />
                </telerik:EditorToolGroup>
            </Tools>
        </telerik:RadEditor>
        </td>
</tr>
<tr style="width: 180px; height: 19px;">
		<td style="width: 146px"><span style="font-size: 9pt; color: #000000">
		    Ngày nhập</span>
    </td>
        <td style="width: 169px">
			    <telerik:RadDatePicker ID="dtNgayNhap" MinDate="1/1/1900" Culture="Vietnamese (Vietnam)"
			                 Style="vertical-align: middle;" runat="server"
			                 Skin="Web20">
			       </telerik:RadDatePicker>
        </td>
</tr>
		<tr>
            <td  colspan="3">
            
            <asp:Panel ID="panel1" runat="server"></asp:Panel></td>
		</tr>
		<tr>
             <td align="right" colspan="2">
                                 <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                </asp:Button>&nbsp;
                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                                  
                                 
                            </td>
        </tr>
       
    </table>
                </FormTemplate>
            </EditFormSettings>
           </MasterTableView>
           <ClientSettings EnableRowHoverStyle="true">
               <Selecting AllowRowSelect="True" />
               <ClientEvents OnRowDblClick="RowDblClick" />
           </ClientSettings>


<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource_gsnuocthai" runat="server" 
        ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
        SelectCommand="SELECT * FROM [Giamsatnuocthai]"
        DeleteCommand="Delete from Giamsatnuocthai where [Mags]=@original_Mags"
        InsertCommand="Insert into Giamsatnuocthai(Madnghiep,Madotgs,Vitrido,Luuluong,Donvi,Ghichu,Ngaynhap)VALUES (@Madnghiep,@Madotgs,@Vitrido,@Luuluong,@Donvi,@Ghichu,@Ngaynhap)"
        UpdateCommand="UPDATE [Giamsatnuocthai] SET [Madnghiep] = @Madnghiep, [Madotgs]=@Madotgs,[Vitrido]=@Vitrido,[Luuluong]=@Luuluong,[Donvi]=@Donvi,[Ghichu]=@Ghichu,[Ngaynhap]=@Ngaynhap WHERE [Mags] = @original_Mags"
        OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
        
        
        
            <DeleteParameters>
               <asp:Parameter Name="original_Mags" Type="Int32" />
           </DeleteParameters>
           <UpdateParameters>
               
                <asp:Parameter Name="Madnghiep" Type="Int32" />
                <asp:Parameter Name="Madotgs" Type="Int32" />
                <asp:Parameter Name="Vitrido" Type="String" />
                <asp:Parameter Name="Luuluong" Type="Double" />
                <asp:Parameter Name="Donvi" Type="String" />              
                <asp:Parameter Name="Ghichu" Type="String" />
                <asp:Parameter Name="Ngaynhap" Type="DateTime" />
               
                <asp:Parameter Name="original_Mags" Type="Int32" />
               
               
           </UpdateParameters>
           <InsertParameters>                
                <asp:Parameter Name="Madnghiep" Type="Int32" />
                <asp:Parameter Name="Madotgs" Type="Int32" />
                <asp:Parameter Name="Vitrido" Type="String" />
                <asp:Parameter Name="Luuluong" Type="String" />
                <asp:Parameter Name="Donvi" Type="String" />              
                <asp:Parameter Name="Ghichu" Type="String" />
                <asp:Parameter Name="Ngaynhap" Type="DateTime" />
           </InsertParameters>
        </asp:SqlDataSource>
          <asp:SqlDataSource ID="giamsat_dn" runat="server" 
                ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
                SelectCommand="SELECT [Madnghiep], [TenDN] FROM [Doanhnghiep]">
            </asp:SqlDataSource>
         <asp:SqlDataSource ID="giamsat_dotgs" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" 
                        SelectCommand="SELECT [Madotgs], [Dotgiamsat] FROM [Dotgiamsat]">
                    </asp:SqlDataSource>
       <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="200px" />
       <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor2" runat="server" TextBoxStyle-Width="150px" />
       <telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server" DropDownStyle-Width="110px" />
       <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px" />



</asp:Content>

